package com.sali.b_design_pattern.c_factory_method_pattern.lesson_02;

import com.sali.b_design_pattern.c_factory_method_pattern.lesson_02.factory.impl.CircleBlockFactory;
import com.sali.b_design_pattern.c_factory_method_pattern.lesson_02.factory.impl.SquareBlockFactory;

public class Lesson02Starter {

    public static void main(String[] args) {
        // 创建积⽊⼯⼚系统
        BlockFactorySystem factorySystem = new BlockFactorySystem();
        // 读取⽣产次数
        int productionCount = 1;
        // 读取每次⽣产的积⽊类型和数量
        for (int i = 0; i < productionCount; i++) {
            String[] productionInfo = new String[]{"Circle", "3"};
            String blockType = productionInfo[0];
            int quantity = Integer.parseInt(productionInfo[1]);
            if (blockType.equals("Circle")) {
                factorySystem.produceBlocks(new CircleBlockFactory(), quantity);
            } else if (blockType.equals("Square")) {
                factorySystem.produceBlocks(new SquareBlockFactory(), quantity);
            }
        }
    }

}
